package com.guet.ltomanagement.service.impl;

import com.guet.ltomanagement.entity.SysAttribute;
import com.guet.ltomanagement.entity.SysUnit;
import com.guet.ltomanagement.mapper.SysAttributeMapper;
import com.guet.ltomanagement.mapper.SysUnitMapper;
import com.guet.ltomanagement.service.SysAttributeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sjj
 * @since 2023-03-07
 */
@Service
public class SysAttributeServiceImpl extends ServiceImpl<SysAttributeMapper, SysAttribute> implements SysAttributeService {

    @Autowired
    SysAttributeMapper sysAttributeMapper;

    @Override
    public Boolean add(SysAttribute sysAttribute) {
        sysAttribute.setCreated(LocalDateTime.now());
        return sysAttributeMapper.insert(sysAttribute) == 1;
    }

    @Override
    public Boolean update(SysAttribute sysAttribute) {
        return sysAttributeMapper.updateById(sysAttribute) == 1;
    }

    @Override
    public Boolean delete(int sysAttributeId) {
        return sysAttributeMapper.deleteById(sysAttributeId) == 1;
    }

    @Override
    public List<SysAttribute> getAttbuteList() {
        return sysAttributeMapper.selectList(null);
    }
}
